﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lcmyjobs.Web.Admin
{
    public partial class ShowEnterpriseBasic : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request["enterprise_bid"]))
                {
                    int bid = Convert.ToInt32(Request["enterprise_bid"]);

                    ShowInfo(bid);
                    Bind(bid);

                }
            }
        }

        private void ShowInfo(int enterprise_bid)
        {
            lcmyjobs.BLL.enterprise_basic bll = new lcmyjobs.BLL.enterprise_basic();
            DataSet ds = bll.Get_enterprise_basic(enterprise_bid);

            DataTable dt_basic = ds.Tables[0];
            DataTable dt_trade = ds.Tables[1];

            if (dt_trade.Rows.Count > 0)
            {
                string tradename = "";

                for (int i = 0; i < dt_trade.Rows.Count; i++)
                {
                    tradename += dt_trade.Rows[i]["tradename"].ToString() + ",";
                }

                this.txttrade.Text = tradename.Substring(0, tradename.Length - 1);

            }

            if (dt_basic.Rows.Count > 0)
            {
                this.lblname.Text = dt_basic.Rows[0]["name"].ToString() + " 详细信息";

                //this.hid_bid.Value = dt_basic.Rows[0]["enterprise_bid"].ToString();
                this.txtname.Text = dt_basic.Rows[0]["name"].ToString();
                this.txthuji.Text = dt_basic.Rows[0]["area_name"].ToString();
                this.ddl_dwxz.Text = dt_basic.Rows[0]["dwxz"].ToString();
                this.ddldwgm.Text = dt_basic.Rows[0]["dwgm"].ToString();
                this.txtclnf.Text = dt_basic.Rows[0]["clnf"].ToString();
                this.txtlxr.Text = dt_basic.Rows[0]["lxr"].ToString();
                this.txttelephone.Text = dt_basic.Rows[0]["telephone"].ToString();
                this.txtfax.Text = dt_basic.Rows[0]["fax"].ToString();
                this.txtmobilephone.Text = dt_basic.Rows[0]["mobilephone"].ToString();
                this.txtemail.Text = dt_basic.Rows[0]["email"].ToString();
                this.txtwebsite.Text = dt_basic.Rows[0]["website"].ToString();
                this.txtplace.Text = dt_basic.Rows[0]["place"].ToString();
                this.txtaddress.Text = dt_basic.Rows[0]["address"].ToString();
                this.txtinterviewadd.Text = dt_basic.Rows[0]["interviewadd"].ToString();
                this.txtabout.Text = dt_basic.Rows[0]["about"].ToString();


                

            }
        }

        private void Bind(int enterprise_bid)
        {
            int count = 0;
            lcmyjobs.BLL.enterprise_releasejob rb = new BLL.enterprise_releasejob();
            DataSet dsjob = rb.Get_enterprise_releasejobtotal(enterprise_bid, 1, 20, 0, out count);

            if (count > 0)
            {
                this.GridView1.DataSource = dsjob;
                this.GridView1.DataBind();
            }
            else
            {
                this.GridView1.Visible = false;
                this.LBL_NOJOB.Text = "无";
            }
        }
    }
}